<!--企业检修计划-->
<template>
    <Layout>
        <Form ref="queryForm" :model="dataToQuery" :label-width="120">
            <Row class="query-form">
                <Col span="8">
                    <FormItem label="二级集团：">
                        <two-level-org class="query-form-el" org-code v-model="dataToQuery.twoLevelOrgCode" />
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="企业名称：" prop="companyId">
                        <company-select v-model="dataToQuery.companyName" style="width:100%" />
                        <!-- <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgname='setQueryOrgName'
                                      :orgTree="true" disabled
                                      :setCurrentName="{label:dataToQuery.companyName,value:dataToQuery.companyId}"></cascader-dom> -->
                    </FormItem>
                </Col>
                <Col span="8" v-if="!switchFlag">
                    <Button @click="switchQuery(true)" class="ivu-btn-switch" type="text">展开∨</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button type="primary" class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
                <Col span="8" v-else>
                    <FormItem label="检修开始时间：" prop="repairStartTime">
                        <DatePicker class="query-form-el" v-model="dataToQuery.repairStartTimeRange" format="yyyy-MM-dd"
                                    type="daterange" placement="bottom-end" placeholder="请选择计划检修时间段"
                                    @on-change="(date) => onSelectFieldQueryDateRange(date, 'repairStartTime')"></DatePicker>
                    </FormItem>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="检修结束时间：" prop="repairEndTime">
                        <DatePicker class="query-form-el" v-model="dataToQuery.repairEndTimeRange" format="yyyy-MM-dd"
                                    type="daterange" placement="bottom-end" placeholder="请选择计划检修时间段"
                                    @on-change="(date) => onSelectFieldQueryDateRange(date, 'repairEndTime')"></DatePicker>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label='维修状态：' prop="repairStatus">
                        <Select v-model='dataToQuery.repairStatusArr' multiple :clearable="false">
                            <!-- <Option value="未开始">未开始</Option> -->
                            <Option value="维修中">维修中</Option>
                            <Option value="已完成">已完成</Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span="8">
                    <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
            </Row>
            <Row class="query-form">
                <Col span="24">
                    <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                    <download-button :api="exportUrl" :queryForm="dataToQuery" :post='true' />
                    <!-- <Button type="primary" class="ivu-btn-add" icon="md-cloud-download" @click="exportFormSubmit">导出</Button> -->
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" no-data-text="没有查询到相关数据!"
            @on-sort-change="sortChange"
               :loading='pageStatus.loading' border :columns="columns1" :data="dataTable">
        </Table>
        <!--分页-->
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize"
                      @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>
        <!--新增、修改、详情-->
        <Modal :title="getModalTitle('企业检修作业')" :transfer=false :mask-closable="false"
               v-model="dialogShow" v-if="dataToView && dialogShow" :width=850 class-name='limit-height-dialog'>
            <Row>
                <Col span="24">
                    <Form ref="dialogForm" :class="mode === 'view'?'modal-view-detail':'modal-form'"
                          :show-message="false" :model="dataToView" :rules="mode === 'view'?{} :ruleCustom"
                          :label-position="mode === 'view'?'right':'top'" :label-width="mode === 'view'?130:null">
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='企业名称：' prop='companyId'>
                                    <div v-if="mode === 'view'">{{dataToView.companyName}}</div>
                                    <cascader-dom v-else ref='orgCascader' @setOrgInfo='setCompanyId' @setOrgname="setCompanyName" :orgTree="true" :currentOrgId="dataToView.companyId"
                                                  :setCurrentName="{label:dataToView.companyName,value:dataToView.companyId}"></cascader-dom>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='是否计划内维修：' prop='isPlan'>
                                    <div v-if="mode === 'view'">{{ dataToView.isPlan }}</div>
                                    <Select v-else v-model="dataToView.isPlan" class='query-form-el' @on-change="planChange">
                                        <Option value="计划内">计划内</Option>
                                        <Option value="计划外">计划外</Option>
                                    </Select>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label='检维修计划内容：' prop='examinationName'>
                                    <div v-if="mode === 'view'">{{ dataToView.examinationName }}</div>
                                    <div v-else>
                                        <Input v-if="dataToView.isPlan==='计划外'" class='query-form-el' placeholder="请填写检维修内容" type='text'
                                               v-model='dataToView.examinationName'></Input>
                                        <Input v-else class='query-form-el' placeholder="请选择检维修计划内容" type='text'
                                               v-model='dataToView.examinationName' @on-focus="modelSelect=true" readonly  suffix="ios-search"></Input>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='检修实际开始时间：' prop="repairStartTime">
                                    <div v-if="mode === 'view'">{{ renderViewDate(dataToView.repairStartTime) }}</div>
                                    <DatePicker v-else class="w" placeholder="请选择检修实际开始时间" v-model='dataToView.repairStartTime' :clearable="false"
                                                :options="{disabledDate(date) {return date && date.valueOf() > new Date();}}"></DatePicker>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='检维修作业结束时间：'>
                                    <div v-if="mode === 'view'">{{ renderViewDate(dataToView.repairEndTime) }}</div>
                                    <DatePicker v-else class="w" placeholder="请选择检维修作业结束时间" v-model='dataToView.repairEndTime' :clearable="false"
                                                :options="{disabledDate(date) {return date && date.valueOf() > new Date();}}"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="检修安全会：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='1').length>0" v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='1')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="检修安全会："  prod="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'examSelectWork/1') }"
                                                :show-upload-list="true"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='1').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='1')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'examSelectWork/1')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="安全交底：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='2').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='2')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="安全交底：" prop="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'examSelectWork/2') }"
                                                :show-upload-list="true"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>点击将文件拖拽到这里上传</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='2').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='2')"
                                         :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'examSelectWork/2')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="检维修过程中现场监督检查：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='3').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='3')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="检维修过程中现场监督检查："  prod="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'examSelectWork/3') }"
                                                :show-upload-list="true"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>上传现场照片或者监督检查相关材料</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='3').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='3')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'examSelectWork/3')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem v-if="mode === 'view'" label="检维修现场验收：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='4').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='4')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                                <FormItem v-else label="检维修现场验收：" prod="idFiles">
                                    <div>
                                        <Upload ref="upload"
                                                :before-upload="(file) => { beforeUpload1(file, 'id', 'examSelectWork/4') }"
                                                :show-upload-list="true"
                                                multiple
                                                type="drag"
                                                :action="fileUrl">
                                            <div style="padding: 10px">
                                                <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                                <p>上传验收材料、现场照片等多个附件</p>
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            </div>
                                        </Upload>
                                    </div>
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='4').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='4')" :key='item'>
                                        <a @click="downloadFiles(item,index)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="removeFile1(item.id, 'id', 'examSelectWork/4')" style="margin-left: 5px;margin-bottom: 3px"/>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                        <!--<Progress  v-show="filePercentVisible[index]" :percent="filePercent[index]"></Progress>-->
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label='备注：' prop='remarks'>
                                    <div v-if="mode === 'view'">{{dataToView.remarks}}</div>
                                    <Input v-else type='textarea' v-model='dataToView.remarks'></Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='填报人：' prop='createUserName'>
                                    <div v-if="mode === 'view'">{{ dataToView.createUserName }}</div>
                                    <Input v-else class='query-form-el' placeholder="请填写填报人" type='text' readonly
                                           v-model='dataToView.createUserName'></Input>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='填报时间：' prop='createDate'>
                                    <div v-if="mode === 'view'">{{ renderViewDate(dataToView.createDate) }}</div>
                                    <DatePicker v-else class="query-form-el" placeholder="请选择填报时间" readonly
                                                v-model='dataToView.createDate'></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                    <Modal :mask-closable="false" :transfer=false footer-hide v-model="modelSelect" :width=1000 title="企业检修计划" @on-cancel="modelSelect=false">
                        <exam-select v-if="modelSelect" v-show="modelSelect" :modelSelect="modelSelect"
                                     :companyName="dataToView.companyName" :companyId="dataToView.companyId" @getSelectModelData='getSelectCount'></exam-select>
                    </Modal>
                </Col>
            </Row>
            <div slot="footer">
                <Button v-if="mode != 'view'" type="primary" class='ivu-btn-save' @click="submit('dialogForm')">确定</Button>
                <Button v-if="mode != 'view'" type="primary" class='ivu-btn-cancel' @click="handleCancel">取消</Button>
                <Button v-if="mode === 'view'" class='ivu-btn-save' @click="dialogShow=false">关闭</Button>
            </div>
        </Modal>

        <Modal title="企业检修计划详情" :transfer=false :mask-closable="false"
               v-model="modelExam" v-if="dataToView && modelExam" :width=850 class-name='limit-height-dialog'>
            <Row>
                <Col span="24">
                    <Form class="modal-view-detail" :show-message="false" :model="dataToView" :label-width="140">
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='企业名称：' prop='companyId'>
                                    <div>{{dataToView.companyName}}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='类别：' prop='categories'>
                                    <div>{{dataToView.categoriesName}}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='涉及的危险作业类别：' prop='hazardousWorkItemArr'>
                                    <div>{{ dataToView.hazardousWorkItemName }}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='检维修内容名称：' prop='examinationName'>
                                    <div>{{ dataToView.examinationName }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label='计划检修范围：' prop='examinationRange'>
                                    <div>{{ dataToView.examinationRange }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='计划检修开始时间：' prop='projectStartSchedule'>
                                    <div>{{ renderViewDate(dataToView.projectStartSchedule)}}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='计划检修结束时间：' prop='projectEndSchedule'>
                                    <div>{{ renderViewDate(dataToView.projectEndSchedule) }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='维修主管部门：' prop='maintenanceDepartment'>
                                    <div>{{ dataToView.maintenanceDepartment }}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='检维修工作负责人：' prop='maintenanceChargePerson'>
                                    <div>{{ dataToView.maintenanceChargePerson }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='外协队伍数量：' prop='teamNumbe'>
                                    <div>{{ dataToView.teamNumbe }}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='检修人数：' prop='staffNumber'>
                                    <div>{{ dataToView.staffNumber }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span="23" class="query-form" style="margin-left: 15px">
                                <Table highlight-row stripe border style="margin-top:10px;margin-bottom: 10px" :max-height="350" :columns="columns2"
                                       :data="dataToView.examConstructionItems">
                                </Table>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="检修计划：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='1').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='1')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="安全方案：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='2').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='2')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label="其他：">
                                    <div v-show="dataToView.idFiles.filter(t=>t.field==='3').length>0"
                                         v-for="(item,index) in dataToView.idFiles.filter(t=>t.field==='3')">
                                        <a @click="downloadFiles(item,index)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>
                                        <Progress v-show="uploadListVisible[item.id]" :percent="uploadListPercent[index]"></Progress>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="23">
                                <FormItem label='备注：' prop='remarks'>
                                    <div>{{dataToView.remarks}}</div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="11">
                                <FormItem label='填报人：' prop='createUserName'>
                                    <div>{{ dataToView.createUserName }}</div>
                                </FormItem>
                            </Col>
                            <Col span="11">
                                <FormItem label='填报时间：' prop='createDate'>
                                    <div>{{ renderViewDate(dataToView.createDate) }}</div>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Col>
            </Row>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="modelExam=false">关闭</Button>
            </div>
        </Modal>

    </Layout>
</template>

<script>
    import {Api} from '@/api/index.js'
    import {sessionStorage} from '@/common/cacheUtils.js';
    import {formatDate} from '@/tools/index'
    var cascaderDom = () => import('@/components/cascader-dom.vue');
    import pageCommonFunction from '@/components/pageCommonFunction.js'
    import examSelect from './examSelect'
    export default {
        components: {cascaderDom, examSelect},
        data() {
            return {
                ...this.createCommonDataField(),
                columns1: [
                    {title: '序号', width: 80, fixed: 'left', align: 'center', render:this.indexColumnsRender},
                    {key: 'companyName', title: '企业名称', align: 'center', minWidth: 200},
                    {key: 'repairStatus', title: '维修状态', minWidth: 100, align: 'center', },
                    {key: 'isPlan', title: '是否计划内维修', minWidth: 100, align: 'center', },
                    {key: 'examinationName', title: '检维修内容名称', minWidth: 200, align: 'center', render: (h, params) => {
                                return h('div', [
                                    h('A', {
                                        style: {
                                            fontSize: '12px',
                                            color: params.row.isPlan==='计划内'?'':'#717477',
                                            pointerEvents:params.row.isPlan==='计划内' ?'':'none'
                                        },
                                        on: {
                                            click: () => {
                                                this.viewModelExam(params.row)
                                            }
                                        }
                                    }, params.row.examinationName),
                                ])
                    }},
                    {key: 'repairStartTime', title: '检修实际开始时间',sortable: "custom", minWidth: 120, align: 'center', render: this.renderCellDate},
                    {key: 'repairEndTime', title: '检维修作业结束时间',sortable: "custom", minWidth: 120, align: 'center', render: this.renderCellDate},
                    {key: 'remarks', title: '备注', minWidth: 200, align: 'center', tooltip: true},
                    this.getActionColumns(),
                ],
                ruleCustom: {
                    companyId: [{required: true, message: '请填写企业名称', trigger: 'change'}],
                    repairStatus: [{required: true, message: '请选择维修状态', trigger: 'change'}],
                    examinationName: [ { required: true, message: '请选择检维修内容名称', trigger: 'change' } ],
                    repairStartTime: [{required: true, message: '请选择检修实际开始时间', trigger: 'change', type: 'date'}],
                    isPlan: [{required: true, message: '请选择是否计划内维修', trigger: 'change', }],
                    // idFiles: [{
                    //     validator: (rule, value, callback) => {
                    //         if (this.dataToView.idFiles.filter(t=>t.field==='2').length < 1) {
                    //             callback('附件必须上传')
                    //         } else {
                    //             callback()
                    //         }
                    //     },
                    //     required: true,
                    //     trigger: 'change'
                    // }]
                },
                tableHeight: 10,
                dictMap:{},
                // api
                exportUrl: Api.exportExamRecords.replace('ExamRecord','ExamRecord/work'),
                queryUrl: Api.queryExamRecords.replace('ExamRecord','ExamRecord/work'),
                deleteUrl: Api.deleteExamRecords.replace('ExamRecord','ExamRecord/work'),
                updateUrl: Api.updateExamRecords.replace('ExamRecord','ExamRecord/work'),
                saveUrl: Api.saveExamRecords.replace('ExamRecord','ExamRecord/work'),
                buttonLoading: false,

                modelSelect: false,
                modelExam: false,
                columns2: [
                    {title: '序号', width: 70, align: 'center', render: this.indexColumnsRender},
                    {key: 'maintenanceName', title: '维修项目', minWidth: 120, align: 'center',tooltip:true},
                    {key: 'maintenanceTeam', title: '维修方', width: 90, align: 'center',
                        render:(h, params)=>{return h('span',params.row.maintenanceTeam=='1'? "企业内修":params.row.maintenanceTeam=='2'?"外包队伍":'')} },
                    {key: 'teamName', title: '队伍名称', minWidth: 110, align: 'center',tooltip:true},
                    {key: 'planMaintenance', title: '计划维修时间', minWidth: 130, align: 'center',
                        render:(h, params)=>{return h('span',this.renderViewDate(params.row.planMaintenanceStart) +'至'+this.renderViewDate(params.row.planMaintenanceEnd))} },
                ],
                examConstruction:{}
            }
        },
        computed: {

        },
        async mounted() {
            this.setTableHeight();
						this.dataToQuery.repairStartTimeRange = [new Date().getFullYear()+'-01-01',new Date().getFullYear()+'-12-31']
						// this.dataToQuery.repairStatusArr = ['维修中']
						this.onSelectFieldQueryDateRange(this.dataToQuery.repairStartTimeRange, 'repairStartTime')
            this.query();
        },
        methods: {
            ...pageCommonFunction,
            planChange(val){
                this.$set(this.dataToView, 'constructionId', '')
                this.$set(this.dataToView, 'examinationName', '')
            },
            getSelectCount(row) {
                this.$set(this.dataToView, 'constructionId', row.id)
                this.$set(this.dataToView, 'examinationName', row.examinationName)
                // this.dataToView.examinationName = row.examinationName;
                this.dataToView.projectEndSchedule = row.projectEndSchedule;
                this.modelSelect = false;
            },
            deleteData(params) {
                this.deleteDateAjax(params);
            },
            query() {
				if (this.dataToQuery.repairStatusArr != null && this.dataToQuery.repairStatusArr != undefined && this.dataToQuery.repairStatusArr.length < 1) {
				    this.dataToQuery.repairStatusArr = null
				}
                this.queryAjax();
            },
            submit(name) {
                this.dataToView.repairStatus = '维修中'
                if (this.dataToView.repairEndTime){
                    this.dataToView.repairStatus= '已完成'
                }
                this.submitAjax(name);
            },
            createEmptyDataToAdd() {
                return {
                    id: this.get_uuid(),
                    idFiles: [],
                    isPlan:'计划内'
                }
            },
            async viewModelExam(row){
                this.dataToView = {...row.examConstruction}
                await this.getFiles1('id', 'examSelect')
                this.modelExam = true
                setTimeout(()=>{
                    this.dialogVisibleChangeHandele(this.modelExam)
                },100)
            },
            async afterDataToViewInit() {
                await this.getFiles1('id', 'examSelectWork');
            },

        }
    }
</script>

<style lang='css' scoped>
    @import '../../../index.css';
</style>
